package com.recipeexchange

class CommentTagLib{
    static namespace = "comments"

    def renderComments =  { attrs, body ->
		def bean = attrs.bean
		def noEscape = attrs.containsKey('noEscape') ? attrs.noEscape : false

		plugin.isAvailable(name:"grails-ui") {
			noEscape = true
		}
		if(bean?.metaClass?.hasProperty(bean, "comments")) {
			out << g.render(template:"/commentable/comments", model:[commentable:bean, noEscape:noEscape])
		}
	}
}